package Exec01;

import util.JDBCUtils;

import java.sql.Connection;
import java.sql.PreparedStatement;

/**
 * @Author: yg
 * @create 2025-01-25 - 16:56
 * @
 */
public class UpdateForAccount {
    public void updateAccount(String sql, Object ...args){
        Connection conn = null;
        PreparedStatement ps = null;
        try {
            conn = JDBCUtils.getConnection();
            ps = conn.prepareStatement(sql);
            for (int i = 0; i < args.length; i++) {
                ps.setObject(i+1, args[i]);
            }
            ps.execute();
        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
            JDBCUtils.closeResource(conn, ps);
        }
    }

//    public static Connection getConnection(){
//
//    }
}
